$(function() {
    var token = $('#ProjectToken').val();
    $("#file_upload").uploadify({
        'height'        : 30,
        'swf'           : root+'uploadify/uploadify.swf',
        'uploader'      : root+'uploadify/uploadify_project.php',
        'width'         : 120,
        'onUploadSuccess' : function(file, data, response) {
            $.ajax({
                'url':'/backend/projects/upload/'+data+'/'+token,
//                'url': uploadProjectImageUrl+'/'+data+'/'+token,
                'success': function(data) {
                    refreshList(token);
                }
            });
        } 
    });
    refreshList(token);
});
function refreshList(token){
    $.ajax({
        'url': '/backend/projects/list/'+token,
//        'url': listProjectImageUrl+'/'+token ,
        'success': function(data) {
            $('#fileList').html(data);
            $('#fileList a').click(function(){
                var href = $(this).attr('href');
                $.ajax({
                    'url': href+'/'+token,
                    'success': function(data) {
                        refreshList(token);
                    }
                });
                return false;
            });
        }
    });
}